Is there a script that will aggregate an enumerated attribute from children to parents? For example, Review Status has choices New, In-Review, Reviewed and Approved. If some children are Reviewed and others are In-Review, the layout DXL for the parent might say In-Review (selecting minimum) or Partially Reviewed. |
Re: Aggregate an enumerated attribute How about some Layout DXL code that counts the number of children for a level 1 object. I think you should be able to use this as a start to aggregate your enumerated data. Just add this code to a layout DXL column in your view and make the changes you need. pragma runLim,0 int nChildren = 0 string strChildren = "" Object objChild if(level(obj)==1&&!isDeleted(obj)) { for objChild in obj do { if(!isDeleted(objChild)) { nChildren++ } } } if (nChildren > 0) strChildren = nChildren "" display strChildren |
Re: Aggregate an enumerated attribute You cannot have an attribute that is both 'normal' and with selectable values, and is also AttrDXL with automatic values. In your case you seem to be suggesting how to allow child objects (e.g. requirements) to have selectable values, but somehow calculate the values of the parents based on the child values; no you cannot do that. You can have a 2nd AttrDXL attribute that summarizes the aggregate values of the other attribute and values of the children. You can also have a separate DXL run on demand that presumes that child objects have actual values and the parent values are currently ignored, but calculated and set by the DXL script. That means that anyone setting a parent value explicitly is wasting their time since the script will overwrite that value the next time it runs.
|